package cn.wikiflyer.beikang.act.study;

import com.umeng.socialize.media.UMImage;

import net.tsz.afinal.annotation.view.ViewInject;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import cn.wikiflyer.beikang.BaseActivity;
import cn.wikiflyer.beikang.R;
import cn.wikiflyer.beikang.act.home.NewsAct;
import cn.wikiflyer.beikang.act.study.bean.BKStudyListBean.StudyItemBean;
import cn.wk.libs4a.net.WKAsyncTaskPro;
import cn.wk.libs4a.utils.WKTimeUtils;
import cn.wk.libs4a.view.WKHeader;

/**
 * 学习——普通图文
 * 
 * @author qunlee_mr
 * 
 */
public class StudyNormalInfoAct extends BaseActivity {

	@ViewInject(id = R.id.header)
	private WKHeader header;

	@ViewInject(id = R.id.study_title)
	private TextView titleText;
	@ViewInject(id = R.id.study_company)
	private TextView companyText;
	@ViewInject(id = R.id.study_time)
	private TextView timeText;
	@ViewInject(id = R.id.tv_content)
	private TextView tv_content;

	private StudyItemBean studyItemBean;

	@Override
	public void loadXml() {
		setContentView(R.layout.bk_act_study_normal);
	}

	@Override
	public void init() {
		Intent intent = getIntent();
		studyItemBean = (StudyItemBean) intent.getSerializableExtra("bean");
		String time = intent.getStringExtra("time");
		header.setClickListener(null, null, new OnClickListener() {
			public void onClick(View arg0) {
				app().shareFenxiang(StudyNormalInfoAct.this);
			}
		});
		titleText.setText(studyItemBean.title);
		timeText.setText(""
				+ WKTimeUtils.getMMddhhMMFromLong(studyItemBean.inputtime));
		tv_content.setText(studyItemBean.description);
	}

	@Override
	public void setData() {
		new GetStudyInfoTask(ctx);
	}

	/**
	 * 获取学习详情接口
	 */
	class GetStudyInfoTask extends WKAsyncTaskPro {
		public GetStudyInfoTask(Context context) {
			super(context);
		}

		@Override
		protected String doInBackground(boolean... params) {
			return app().net.getStudyInfo("" + studyItemBean.id);
		}

		@Override
		protected void doOnPostExecute(String result, boolean isLocal) {
			System.out.println("" + result);
		}
	}

}
